﻿namespace RecaptchaMvc {
	public class RecaptchaResponse : IRecaptchaResponse {
		public static readonly RecaptchaResponse InvalidSolution;
		public static readonly RecaptchaResponse RecaptchaNotReachable;
		public static readonly RecaptchaResponse Unknown;
		public static readonly RecaptchaResponse Valid;

		static RecaptchaResponse() {
			RecaptchaResponse.InvalidSolution = new RecaptchaResponse(false, "incorrect-captcha-sol");
			RecaptchaResponse.RecaptchaNotReachable = new RecaptchaResponse(false, "recaptcha-not-reachable");
			RecaptchaResponse.Unknown = new RecaptchaResponse(false, "unknown");
			RecaptchaResponse.Valid = new RecaptchaResponse(true);
		}
		public RecaptchaResponse(bool isValid) : this(isValid, null) {}
		public RecaptchaResponse(bool isValid, string errorCode) {
			this.IsValid = isValid;
			this.ErrorCode = errorCode;
		}

		public string ErrorCode { get; private set; }
		public bool IsValid { get; private set; }
	}
}